import request from "@/utils/request";

const BASE_URL = "/admin";

const meteAPI = {
  /** 删除订单 */
  getPageorderDel(data?: any) {
    return request<any, PageResult<PageVO[]>>({
      url: `${BASE_URL}/order/del`,
      method: "post",
      data,
    });
  },

  /** 社 */
  invoiceVerify(data?: any) {
    return request<any>({
      url: `${BASE_URL}/invoice/invoiceApply/verify`,
      method: "POST",
      data,
    });
  },
  /** 获取发票列表 */
  invoiceApplyList(data?: any) {
    return request<any, PageResult<PageVO[]>>({
      url: `${BASE_URL}/invoice/invoiceApply/pageList`,
      method: "POST",
      data,
    });
  },

  /** 获取通知轮播分页数据 */
  getPay(data?: any) {
    return request<any>({
      url: `${BASE_URL}/order/prepayForAdmin`,
      method: "POST",
      data,
    });
  },

  /** 获取通知轮播分页数据 */
  getPage(data?: metePageQuery) {
    return request<any, PageResult<PageVO[]>>({
      url: `${BASE_URL}/order/pageList`,
      method: "POST",
      data,
    });
  },

  /** 获取通知轮播分页数据 */
  getPageInfo(data?: any) {
    return request<any>({
      url: `${BASE_URL}/order/detail`,
      method: "POST",
      data,
    });
  },

  /**
   * 批量删除
   *
   * @param ids IDs数组
   */
  deleteByIds(data: any) {
    return request({
      url: `${BASE_URL}/user/meterReader/del`,
      method: "post",
      data,
    });
  },

  /**
   * 更新
   *
   * @param id ID
   * @param data 轮播组表单数据
   */
  update(data: Form) {
    return request({
      url: `${BASE_URL}/user/meterReader/update`,
      method: "post",
      data,
    });
  },

  /**
   * 新建订单
   *
   * @param data 订单form
   * @returns
   */
  add(data: Form) {
    return request({
      url: `${BASE_URL}/order/add`,
      method: "post",
      data,
    });
  },
  /**
   * 修改用户密码
   *
   * @param id 用户ID
   * @param password 新密码
   */
  resetPassword(data: any) {
    return request({
      url: `${BASE_URL}/user/meterReader/updateLoginSecret`,
      method: "post",
      data,
    });
  },
};

export default meteAPI;

/** 分页查询参数 */
export interface metePageQuery extends PageQuery {
  /** 订单号 */
  s_order_no?: string;
  /** 用户手机号 */
  s_payer_tel?: string;
  /** 支付状态 */
  pay_status?: string;
  /** 审核状态 */
  verify_status?: string;
  /** 用户id */
  uid?: string;
  // 时间搓
  date?: any;
  // 开始结束时间
  created_at_gte?: string | number;
  created_at_lte?: string | number;
  order_type?: string;
}

/** 分页对象 */
export interface PageVO {
  id: string;
  /** name */
  name?: string;
  /** code */
  code?: string;
  /** 备注 */
  remark?: string;
}

/**
 * 表单对象
 */
export interface Form {
  // 订单类型
  order_type: string | number;
  // 订单用户
  payer_aud: string | number;
  // 用户id
  payer_id?: string | number;
  // 金额
  amount: string;
  // 水表id
  water_meter_id: string | number;
  amount_detail: any[];
}

export interface IUser {
  id: number;
  holder_username: string;
  code: string;
  holder_tel: string;
}

/**
 * 主题枚举
 */
export enum amountType {
  /**
   * 基础费
   */
  JCF = "水费",
  /**
   * 滞纳金
   */
  ZNJ = "滞纳金",

  /**
   * 材料费
   */
  CLF = "材料费",

  /**
   * 工程费
   */
  GCF = "工程费",
}
